package org.opens.controller;

import org.flowable.task.api.Task;
import org.opens.dto.StartProcessDto;
import org.opens.service.FlowableService;
import org.opens.util.R;
import org.opens.vo.TaskVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping(value = "/flowable")
public class FlowableController {

    @Autowired
    private FlowableService flowableService;

    @PostMapping(value = "/startProcess")
    public R<String> startProcess(@RequestBody StartProcessDto startProcessDto) {
        return R.success(flowableService.startProcess(startProcessDto));
    }

    @GetMapping(value = "/getTasksByAssign")
    public R<List<TaskVo>> getTasksByAssign(@RequestParam(value = "assign") String assign) {
        return R.success(flowableService.getTasksByAssign(assign));
    }

}
